erDiagram
    USER {
        int user_id PK "主键"
        varchar(50) username "用户名"
        varchar(255) password_hash "密码哈希值"
        varchar(100) email "邮箱"
        datetime created_at "创建时间"
    }

    ADMIN {
        int admin_id PK "主键"
        varchar(50) name "管理员姓名"
        varchar(255) password_hash "密码哈希值"
    }

    QUESTIONNAIRE {
        int questionnaire_id PK "主键"
        int user_id FK "外键，关联USER"
        text answers "问卷答案(JSON格式存储)"
        datetime submitted_at "提交时间"
    }

    USER_TAG {
        int user_tag_id PK "主键"
        int user_id FK "外键，关联USER"
        varchar(50) tag_content "用户标签内容"
    }

    POLICY {
        int policy_id PK "主键"
        varchar(200) title "政策标题"
        text content "政策详情内容"
        varchar(100) issuing_authority "发布机构"
        datetime publish_date "发布日期"
    }

    POLICY_TAG {
        int policy_tag_id PK "主键"
        int policy_id FK "外键，关联POLICY"
        varchar(50) tag_content "政策标签内容"
    }

    MATCH_RESULT {
        int match_id PK "主键"
        int user_id FK "外键，关联USER"
        int policy_id FK "外键，关联POLICY"
        float match_score "匹配度分数"
        datetime matched_at "匹配时间"
    }

    %% 定义关系
    USER ||--o{ QUESTIONNAIRE : "填写"
    USER ||--o{ USER_TAG : "拥有"
    USER ||--o{ MATCH_RESULT : "获得"

    POLICY ||--o{ POLICY_TAG : "拥有"
    POLICY ||--o{ MATCH_RESULT : "被匹配"

    %% 管理员管理政策和用户？ (此关系可根据实际需求增减)
    ADMIN ||--o{ POLICY : "管理"